package com.qfedu.meidijiaju.controller;


import com.qfedu.meidijiaju.common.ResponseData;
import com.qfedu.meidijiaju.entity.ShipuYxy;
import com.qfedu.meidijiaju.service.ShipuYxyService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 * 食谱 前端控制器
 * </p>
 *
 * @author meidimeiju
 * @since 2022-10-05
 */
@Api(tags = "食谱菜品相关模块")
@RestController
@RequestMapping("/meidijiaju/shipu-yxy")
public class ShipuYxyController {

    @Autowired
    private ShipuYxyService shipuYxyService;

    @ApiOperation(value = "/模糊查询食谱菜品")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "caipinName",value = "模糊查询输入的食谱菜品名字",paramType = "query",dataType = "string")
    })
    @RequestMapping(value = "/findShiPuByLike",method = RequestMethod.GET)
    public ResponseData<List<ShipuYxy>> findShiPuByLike(String caipinName){

        return shipuYxyService.findShiPuByLike(caipinName);
    }

    @ApiOperation(value = "/根据食谱菜品id查看菜品详细信息")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "caipinId",value = "菜品对应的id",paramType = "query",dataType = "int")
    })
    @RequestMapping(value = "/findShiPuById",method = RequestMethod.GET)
    public ResponseData<ShipuYxy> findShiPuById(int caipinId){

        return shipuYxyService.findShiPuById(caipinId);

    }
}

